package com.kitri.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kitri.dao.AppContext;
import com.kitri.dao.CourseDao;
import com.kitri.dao.CourseDaoImpl;
import com.kitri.domain.Course;
import com.kitri.domain.Member;

@Service
public class CourseServiceImpl implements CourseService {
	private CourseDao courseDao = null;
	
	public CourseServiceImpl(){
		this.courseDao = ((CourseDaoImpl)AppContext.getAppContext().getBean("courseDao"));
	}
	
	@Override
	public void add(Course course) {
		courseDao.insert(course);
	}
	
	@Override
	public void update(Course course) {
		courseDao.update(course);
	}
	
	@Override
	public void remove(String courseId) {
		courseDao.delete(courseId);
	}

	@Override
	public List<Course> list() {
		return courseDao.selectAll();
	}
	
	@Override
	public Course select(String courseId) {
		return courseDao.select(courseId);
	}

	@Override
	public List<Member> selectOfMember(String courseId) {
		return selectOfMember(courseId);
	}
}
